# coding=utf-8
import datetime
import os
import time


def run_sys(fw, cmd_str):
    current_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
    fw.write('{} start {}\n'.format(current_time, cmd_str))
    fw.flush()
    os.system(cmd_str)
    current_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
    fw.write('{} finished {}\n'.format(current_time, cmd_str))
    fw.flush()


current_date = str(datetime.datetime.now().date()).replace('-', '')
log_path = 'log_{}.txt'.format(current_date)
with open(log_path, 'a') as fw:
    run_sys(fw, 'python3 get_3over.py')
    run_sys(fw, 'python3 get_3down.py')
    # run_sys(fw, 'python3 t1.py')
    # run_sys(fw, 'python3 t2.py')
